'''
Created on Jan 26, 2011

@author: mikeg
'''
from multiprocessing import Pool

def f(x):
    if(x is not 0):
        return x*x - x + 1/x + 1000
    else:
        return x*x + x - 1000

if __name__ == '__main__':
    pool = Pool(processes=4)
    result = pool.apply_async(f, [10])
    print(result.get(timeout=1))
    print(pool.map(f, range(10)))
    